import java.util.Random;

public class Farmyard{
	public static void main(String[] args){
		Animal[] theYard = { new Cat(), new Dog(), new Cow(), new Pig(), new Mouse() };

		Animal currentAnimal;

		//get a random number generator
		Random rng = new Random();

		//make 10 random choices of Animal		
		for (int i = 0; i < 10; i++){
			currentAnimal = theYard[rng.nextInt(theYard.length)];
			System.out.println(currentAnimal.getType() + " " + currentAnimal.speak());
		}
	}
}
/***********************************************************************************
 */

abstract class Animal{
	private String type;

	public Animal(String type){
		this.type = type;
	}

	public String getType(){
		return type;
	}

	public abstract String speak();
}

/************************************************************************************
 */
class Cat extends Animal{
	public Cat(){
		super("Cat");
	}

	public String speak(){
		return ("Miaow");
	}
}


class Mouse extends Animal{
	public Mouse(){
		super("Mouse");
	}

	public String speak(){
		return ("Squeak");
	}
}


class Pig extends Animal{
	public Pig(){
		super("Pig");
	}

	public String speak(){
		return ("Grunt");
	}
}

class Cow extends Animal{
	public Cow(){
		super("Cow");
	}

	public String speak(){
		return ("Moo");
	}
}

class Dog extends Animal{
	public Dog(){
		super("Dog");
	}

	public String speak(){
		return ("Woof");
	}
}